package com.lucker.ds.model;

/**
 * sys_version_config
 * @author 
 */
public class SysVersionConfig extends BaseValueObject {
    private Long id;

    private String systemType;

    private String updateTexts;

    private Integer maxVersionCode;

    private Integer currVersionCode;

    private Integer minVersionCode;

    private String updateUrl;

    private String customQuerySqlText = null;

    private String orderStr = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSystemType() {
        return systemType;
    }

    public void setSystemType(String systemType) {
        this.systemType = systemType;
    }

    public String getUpdateTexts() {
        return updateTexts;
    }

    public void setUpdateTexts(String updateTexts) {
        this.updateTexts = updateTexts;
    }

    public Integer getMaxVersionCode() {
        return maxVersionCode;
    }

    public void setMaxVersionCode(Integer maxVersionCode) {
        this.maxVersionCode = maxVersionCode;
    }

    public Integer getCurrVersionCode() {
        return currVersionCode;
    }

    public void setCurrVersionCode(Integer currVersionCode) {
        this.currVersionCode = currVersionCode;
    }

    public Integer getMinVersionCode() {
        return minVersionCode;
    }

    public void setMinVersionCode(Integer minVersionCode) {
        this.minVersionCode = minVersionCode;
    }

    public String getUpdateUrl() {
        return updateUrl;
    }

    public void setUpdateUrl(String updateUrl) {
        this.updateUrl = updateUrl;
    }

    public void setCustomQuerySqlText(String customQuerySqlText) {
        this.customQuerySqlText = customQuerySqlText;
    }

    public String getCustomQuerySqlText() {
        return customQuerySqlText;
    }

    public void orderById(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by id asc";
            }else{
                this.orderStr = this.orderStr + ",id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by id desc";
            }else{
                this.orderStr = this.orderStr + ",id desc";
            }
        }
    }

    public void orderBySystemType(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by system_type asc";
            }else{
                this.orderStr = this.orderStr + ",system_type asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by system_type desc";
            }else{
                this.orderStr = this.orderStr + ",system_type desc";
            }
        }
    }

    public void orderByUpdateTexts(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by update_texts asc";
            }else{
                this.orderStr = this.orderStr + ",update_texts asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by update_texts desc";
            }else{
                this.orderStr = this.orderStr + ",update_texts desc";
            }
        }
    }

    public void orderByMaxVersionCode(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by max_version_code asc";
            }else{
                this.orderStr = this.orderStr + ",max_version_code asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by max_version_code desc";
            }else{
                this.orderStr = this.orderStr + ",max_version_code desc";
            }
        }
    }

    public void orderByCurrVersionCode(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by curr_version_code asc";
            }else{
                this.orderStr = this.orderStr + ",curr_version_code asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by curr_version_code desc";
            }else{
                this.orderStr = this.orderStr + ",curr_version_code desc";
            }
        }
    }

    public void orderByMinVersionCode(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by min_version_code asc";
            }else{
                this.orderStr = this.orderStr + ",min_version_code asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by min_version_code desc";
            }else{
                this.orderStr = this.orderStr + ",min_version_code desc";
            }
        }
    }

    public void orderByUpdateUrl(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by update_url asc";
            }else{
                this.orderStr = this.orderStr + ",update_url asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by update_url desc";
            }else{
                this.orderStr = this.orderStr + ",update_url desc";
            }
        }
    }
}